from pydantic import BaseModel, ConfigDict
from core.data_types import DatetimeStr


class Dict(BaseModel):
    name: str
    code: str
    disabled: bool | None = False
    desc: str | None = None


class DictSimpleOut(Dict):
    model_config = ConfigDict(from_attributes=True)

    id: int
    create_time: DatetimeStr
    update_time: DatetimeStr


class DictDetail(BaseModel):
    label: str
    value: str
    disabled: bool | None = False
    order: int | None = None
    dict_id: int


class DictDetailSimpleOut(DictDetail):
    model_config = ConfigDict(from_attributes=True)

    id: int
    create_time: DatetimeStr
    update_time: DatetimeStr
